<?php
if (!defined('IN_XLP')) {
    exit('Access Denied');
}
$Document = array(
    'pageid' => 'power-add', //页面标示
    'pagename' => '权限管理', //当前页面名称
    'mycss' => array('content/textlist'), //加载的css样式表
    'myjs' => array(), //加载的js脚本
    'footerjs'=>array('content/fuelux/fuelux', 'content/combodate/moment.min'),
    'head' => true, //加载头部文件
);
include getTpl('header', 'public');
?>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->
<section id="content">
  <section class="main padder">
    <div class="clearfix">
      <h4><i class="fa fa-edit"></i><?php echo trim($Document['pagename'],'_');?></h4>
    </div>
    <div class="row">
      <div class="col-sm-12">
        <section class="panel">
          <div class="panel-body">
            <form class="form-horizontal" method="post" id="form1">
              <div class="form-group"> 
                  <label class="col-sm-1 control-label">用户</label> 
                  <div class="col-sm-3"> 
                   <strong><?php echo $rs['username'];?></strong>
                   <input type="hidden" name="uid" id="uid" placeholder="" value="<?php echo $rs['uid'];?>" class="form-control"/>
                   <input type="hidden" name="village_id" id="village_id" placeholder="" value="<?php echo $rs['village_id'];?>" class="form-control"/>
                   <span class="help-block"></span>
                  </div> 
             </div>
             <div class="form-group"> 
                  <label class="col-sm-1 control-label">所属小区</label> 
                  <div class="col-sm-3"> 
                   <strong ><?php echo $rs['village_name'];?></strong>
                   <span class="help-block"></span>
                  </div> 
             </div>
             <div class="form-group"> 
                  <label class="col-sm-1 control-label">权限</label> 
                  <div class="col-sm-3"> 
                   <?php
                   foreach($list as $k=>$v){
				   ?>
                   <!-- checkbox --> 
                  <div class="checkbox"> 
                   <label class="checkbox-custom"><input type="checkbox" name="<?php echo $k;?>" value="1"/><i class="fa fa-check-square-o"></i><?php echo $v;?></label> 
                  </div>
                   <?php
				   }
				   ?>
                   <span class="help-block"></span>
                  </div> 
             </div>
             <div class="form-group">
                    <label class="col-sm-1 control-label">状态</label>
                    <div class="col-sm-4">
                  <?php
                   foreach($status as $k=>$v){
				   ?>
                        <div class="col-xs-3 radio m-l-large"><label class="radio-custom"><input type="radio" name="status" <?php if($k==1){echo 'checked="checked"';}?> value="<?php echo $k;?>"><i class="fa fa-circle-o"></i><?php echo $v;?></label></div>
				<?php
				   }
				   ?>
                    </div>
                </div>
                <div class="form-group">
                <div class="col-sm-9 col-lg-offset-1">
                  <div class="col-sm-1">
                    <button type="submit" id="sub-ok" data-loading-text="正在提交..." class="btn btn-primary">保存</button>
                  </div>
                  <div class="col-md-offset-2">
                    <button type="button" class="btn btn-white">取消</button>
                  </div>
                </div>
              </div>
            </form>
          </div>
        </section>
      </div>
    </div>
  </section>
</section>
<!--主体 结束--> 
<script>
$(function(){
	$('#form1').submit(function(){
		Msg.loading();
		  $.post('<?php echo U('power/post');?>',$(this).serialize(),function(result){
			  Msg.hide();
			  resetSubmit("#sub-ok",'保存');
			  if (result.status==1){
				Msg.ok('添加成功',function(){
					document.location='<?php echo U('power/index');?>';
				},1000);
			}else{
				Msg.error(result.info);
			}
		  },'json');
		  return false;
	})
})
</script>
<?php
include getTpl('footer', 'public');
?>